cssnode: Redo GTK_DEBUG=no-css-cache
authorBenjamin Otte <otte@redhat.com>
Sat, 16 Jan 2016 03:55:58 +0000 (04:55 +0100)
committerBenjamin Otte <otte@redhat.com>
Sat, 16 Jan 2016 22:58:37 +0000 (23:58 +0100)
Previously this setting would just invalidate the whole CSS tree and
thereby hopefully avoid all cache usage.

Now, we actually don't cause extra invalidations anymore, but instead
avoid ever inserting anything into the cache when this setting is set.

gtk/gtkcssnode.c
gtk/gtkcssnodestylecache.c

index 1106bdbe7add6dd25e64f6f38f73ac371cfe5baf..aac0bb3d9d4ce7f88086bb66f321f7930991a4b3 100644 (file)
@@ -22,7 +22,6 @@
 #include "gtkcssanimatedstyleprivate.h"
 #include "gtkcsssectionprivate.h"
 #include "gtkcssstylepropertyprivate.h"
-#include "gtkdebug.h"
 #include "gtkintl.h"
 #include "gtkmarshalers.h"
 #include "gtksettingsprivate.h"
@@ -1372,23 +1371,6 @@ gtk_css_node_validate_internal (GtkCssNode *cssnode,
 {
   GtkCssNode *child;
 
-  /* If you run your application with
-   *   GTK_DEBUG=no-css-cache
-   * every invalidation will purge the cache and completely query
-   * everything anew form the cache. This is slow (in particular
-   * when animating), but useful for figuring out bugs.
-   *
-   * We achieve that by pretending that everything that could have
-   * changed has and so we of course totally need to redo everything.
-   *
-   * Note that this also completely revalidates child widgets all
-   * the time.
-   */
-#ifdef G_ENABLE_DEBUG
-  if (GTK_DEBUG_CHECK (NO_CSS_CACHE))
-    cssnode->pending_changes |= GTK_CSS_CHANGE_ANY;
-#endif
-
   if (!cssnode->invalid)
     return;
 
index 8c250bcac664fd95d144eb3b2396b90adba5e8eb..b07776d6663db40c1c001f29c9746628d7eeedbb 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "gtkcssnodestylecacheprivate.h"
 
+#include "gtkdebug.h"
 #include "gtkcssstaticstyleprivate.h"
 
 struct _GtkCssNodeStyleCache {
@@ -78,6 +79,18 @@ may_be_stored_in_cache (GtkCssStyle *style)
 {
   GtkCssChange change;
 
+  /* If you run your application with
+   *   GTK_DEBUG=no-css-cache
+   * no caching will happen. This is slow (in particular
+   * when animating), but useful for figuring out bugs.
+   *
+   * We achieve that by disallowing any inserts into caches here.
+   */
+#ifdef G_ENABLE_DEBUG
+  if (GTK_DEBUG_CHECK (NO_CSS_CACHE))
+    return FALSE;
+#endif
+
   if (!GTK_IS_CSS_STATIC_STYLE (style))
     return FALSE;